﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="hrAddToResumeType.aspx.cs" Inherits="ZX.WebApp.EHR.hrAddToResumeType" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
     <script src="../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/json/json-min.js"></script>
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/connection/connection-min.js"></script>
    <script type="text/javascript">
        //获取简历类别
        function GetAllResumeType() {
            var url = "../Extend/AjaxData/jsonlist.aspx?entity=hrCandidateCategory";
            $.get(url, function (d, s) {
                var list = eval("(" + d + ")");
                if (list.total > 0) {
                    for (var o in list.rows) {
                        var v = list.rows[o].ID;
                        var t = list.rows[o].CategoryName;
                        $("#resumeType").append("<option value='" + v + "'>" + t + "</option>");
                    }
                }
                else {
                    alert("没有简历类型,请先维护简历类别!");
                    parent.closeWin();
                }
            })
        }


        $(document).ready(function () {
            GetAllResumeType(); //获取所有简历类别
        });

        //获取url里的参数值 name:参数名称
        function getPar(source, name) {
            var reg = new RegExp("(^|\\?|&)" + name + "=([^&]*)(\\s|&|$)", "i");
            if (reg.test(source))
                return RegExp.$2;
            return "";
        };
        function getPar1(name) {
            var _url = "http://" + document.location;
            return getPar(_url, name);
        }
        function Save() {
            //添加到简历类别
            var id = getPar1("id");
            if (id == "") return;
            var resumetype = $("#resumeType").val();
            YAHOO.util.Connect.asyncRequest('POST', "../../EHR/hrAjax.aspx?flag=addresumetype&id=" + id+"&resumetype="+resumetype, {
                success: function (res) {
                    try {
                        var str = res.responseText;
                        if (str.substring(0, 1) == "0") {
                            if (str.length == 1) { //添加成功
                                alert("数据保存成功！");
                            }
                            else {
                                var tempStr = str.substring(1, str.length - 1);
                                var token = tempStr.split('_');
                                var errMsg = "以下人员数据保存失败：\r\n";
                                for (var j = 0; j < token.length; j++) {
                                    if (token[j] != "") {
                                        if (j != token.length - 1) {
                                            errMsg = errMsg + de[token[j]] + "\r\n";
                                        }
                                        else {
                                            errMsg = errMsg + de[token[j]]
                                        }
                                    }
                                }
                                alert(errMsg);
                            }
                        }
                        else {
                            alert("数据保存失败！");
                        }
                        parent.closeWin();
                    }
                    catch (e) {
                    }
                    finally {
                    }
                },
                failure: function (error) {
                    alert("数据错误:" + error.statusText);
                }
            }, null);
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <br />
    <br />
    <table style="font-family: 宋体, Arial, Helvetica, sans-serif; font-size: small">
      <tr>
        <td>&nbsp;&nbsp;</td>
        <td>
          简历类别：<select id="resumeType" style="width:160px" ></select>
        </td>
      </tr>
      </table>
    </div>
    </form>
</body>
</html>
